console.log('background.js');

function decryptQrCode(info, tab) {
    console.log('识别:', info, tab);
    chrome.tabs.sendMessage(tab.id, { url: info.srcUrl }, function (response) {
        console.log('response:', response);
    });
}

chrome.contextMenus.create({
    type: 'normal',
    title: '识别图片二维码',
    contexts: ['image'],
    onclick: decryptQrCode
});